package com.ganmiao.web.portal.controller;


import com.ganmiao.server.supplier.entity.Supplier;
import com.ganmiao.server.supplier.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/suppliers")
public class SupplierController {

    @Autowired
    private SupplierService supplierService;

    @PostMapping("/insert")
    public int suppliersInsert(@RequestBody Supplier suppliers){
        return supplierService.suppliersInsert(suppliers);
    }

    @GetMapping("/get")
    public Supplier suppliersGet(@RequestParam Integer id){
        return supplierService.suppliersGet(id);
    }

    @PutMapping("/put/{id}")
    public void suppliersUpdate(@PathVariable Integer id, @RequestBody Supplier supplier) {
        supplierService.suppliersUpdate(id, supplier);
    }

    @DeleteMapping("/delete/{id}")
    public void suppliersDelete(@PathVariable Integer id) {
        supplierService.suppliersDelete(id);
    }
}
